furny.swing.admin.viewer
Class ModelViewerState

java.lang.Object
  extended by com.jme3.app.state.AbstractAppState
      extended by furny.jme.appstate.RootNodeState
          extended by furny.jme.appstate.SimpleAppState
              extended by furny.swing.admin.viewer.ModelViewerState
All Implemented Interfaces:
com.jme3.app.state.AppState, IModelViewer

public class ModelViewerState
extends SimpleAppState
implements IModelViewer

App state for the model viewer.

Since:
12.08.2012
Author:
Stephan Dreyer

Nested Class Summary
private  class ModelViewerState.ChaseCam2
          Extended ChaseCamera that allows to set the zoom speed.
 
Nested classes/interfaces inherited from class furny.jme.appstate.SimpleAppState
SimpleAppState.VIEWPORT
 
Field Summary
private  com.jme3.scene.Node arrowNode
           
private  com.jme3.scene.Node axisNode
           
private  com.jme3.material.Material blueMaterial
           
private  com.jme3.scene.Node camTarget
           
private  ModelViewerState.ChaseCam2 chaseCam
           
private  com.jme3.font.BitmapFont consoleFont
           
private  java.text.NumberFormat floatFormat
           
private  Furniture furniture
           
private  com.jme3.material.Material greenMaterial
           
private  boolean hasModel
           
private  com.jme3.font.BitmapText infoText
           
private  com.jme3.font.BitmapText infoText2
           
private  com.jme3.font.BitmapText infoText3
           
private  FurnyApplication mainApp
           
private  boolean manual
           
private  com.jme3.scene.Node modelNode
           
private  IModelSource modelSource
           
private  com.jme3.material.Material redMaterial
           
private  boolean rotating
           
private  com.jme3.scene.Node scaleGrid
           
private  boolean showDirectionArrow
           
private  boolean showGrid
           
private  boolean showScaleGrid
           
private  boolean showUserScaleGrid
           
private  com.jme3.scene.Node userScaleGrid
           
 
Fields inherited from class furny.jme.appstate.SimpleAppState
app, assetManager, cam, context, createViewPort, flyCam, fpsText, guiFont, guiNode, guiViewPort, INPUT_MAPPING_CAMERA_POS, INPUT_MAPPING_EXIT, INPUT_MAPPING_MEMORY, inputManager, renderer, renderManager, secondCounter, settings, showSettings, statsView, viewPort
 
Fields inherited from class furny.jme.appstate.RootNodeState
rootNode
 
Fields inherited from class com.jme3.app.state.AbstractAppState
initialized
 
Constructor Summary
ModelViewerState(IModelSource modelSource, FurnyApplication app)
          Instantiates a new model viewer app state.
 
Method Summary
 void arrangeText(int width, int height)
          Arrange the text.
 void centerFurniture(boolean save)
          Centers the furniture.
 boolean isClosed()
          Checks if the context is closed.
 boolean isRotating()
          Checks if is rotating.
 boolean isShowDirection()
          Checks if is showing direction.
 boolean isShowGrid()
          Checks if is showing grid.
 boolean isShowScaleGrid()
          Checks if is showing scale grid.
 boolean isShowUserScaleGrid()
          Checks if is showing user scale grid.
private  void loadModel(int offset)
          Load a model.
static void main(java.lang.String[] args)
          Main method to test the class.
 void rotateFurniture(float rotation, boolean save)
          Rotate furniture.
 void setFurniture(Furniture furn)
          Method to set a furniture to view.
 void setRotating(boolean rotating)
          Sets the rotating flag.
 void setShowDirection(boolean showDirectionArrow)
          Sets the show direction flag.
 void setShowGrid(boolean show)
          Sets the show grid flag.
 void setShowScaleGrid(boolean showScaleGrid)
          Sets the show scale grid flag.
 void setShowUserScaleGrid(boolean showUserScaleGrid)
          Sets the show user scale grid flag.
 void simpleInitAppState()
          Simple initialization method.
 void simpleUpdate(float tpf)
          Simple update method.
 
Methods inherited from class furny.jme.appstate.SimpleAppState
getCamera, getFlyByCamera, getFpsText, getGuiNode, getGuiViewPort, getViewPort, initialize, isShowStatistics, setDisplayFps, setDisplayStatView, setOverrideSize, setShowStatistics, update
 
Methods inherited from class furny.jme.appstate.RootNodeState
getRootNode
 
Methods inherited from class com.jme3.app.state.AbstractAppState
cleanup, isEnabled, isInitialized, postRender, render, setEnabled, stateAttached, stateDetached
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface furny.swing.admin.viewer.IModelViewer
isShowStatistics, setShowStatistics
 

Field Detail

modelSource

private final IModelSource modelSource

chaseCam

private ModelViewerState.ChaseCam2 chaseCam

camTarget

private com.jme3.scene.Node camTarget

modelNode

private com.jme3.scene.Node modelNode

axisNode

private com.jme3.scene.Node axisNode

arrowNode

private com.jme3.scene.Node arrowNode

scaleGrid

private com.jme3.scene.Node scaleGrid

userScaleGrid

private com.jme3.scene.Node userScaleGrid

infoText

private com.jme3.font.BitmapText infoText

infoText2

private com.jme3.font.BitmapText infoText2

infoText3

private com.jme3.font.BitmapText infoText3

consoleFont

private com.jme3.font.BitmapFont consoleFont

redMaterial

private com.jme3.material.Material redMaterial

greenMaterial

private com.jme3.material.Material greenMaterial

blueMaterial

private com.jme3.material.Material blueMaterial

furniture

private Furniture furniture

rotating

private boolean rotating

manual

private boolean manual

showGrid

private boolean showGrid

showScaleGrid

private boolean showScaleGrid

showUserScaleGrid

private boolean showUserScaleGrid

showDirectionArrow

private boolean showDirectionArrow

hasModel

private boolean hasModel

floatFormat

private final java.text.NumberFormat floatFormat

mainApp

private final FurnyApplication mainApp
Constructor Detail

ModelViewerState

public ModelViewerState(IModelSource modelSource,
                        FurnyApplication app)
Instantiates a new model viewer app state.

Parameters:
modelSource - the model source
app - the app
Since:
12.08.2012
Method Detail

simpleInitAppState

public void simpleInitAppState()
Description copied from class: SimpleAppState
Simple initialization method. Place init code here.

Specified by:
simpleInitAppState in class SimpleAppState

setShowGrid

public void setShowGrid(boolean show)
Description copied from interface: IModelViewer
Sets the show grid flag.

Specified by:
setShowGrid in interface IModelViewer
Parameters:
show - show grid

isShowGrid

public boolean isShowGrid()
Description copied from interface: IModelViewer
Checks if is showing grid.

Specified by:
isShowGrid in interface IModelViewer
Returns:
true, if is showing grid

isShowDirection

public boolean isShowDirection()
Description copied from interface: IModelViewer
Checks if is showing direction.

Specified by:
isShowDirection in interface IModelViewer
Returns:
true, if is showing direction

setShowDirection

public void setShowDirection(boolean showDirectionArrow)
Description copied from interface: IModelViewer
Sets the show direction flag.

Specified by:
setShowDirection in interface IModelViewer
Parameters:
showDirectionArrow - the new show direction flag.

isRotating

public boolean isRotating()
Description copied from interface: IModelViewer
Checks if is rotating.

Specified by:
isRotating in interface IModelViewer
Returns:
true, if is rotating

setRotating

public void setRotating(boolean rotating)
Description copied from interface: IModelViewer
Sets the rotating flag.

Specified by:
setRotating in interface IModelViewer
Parameters:
rotating - the new rotating flag

isClosed

public boolean isClosed()
Checks if the context is closed.

Returns:
true, if is closed
Since:
12.08.2012

loadModel

private void loadModel(int offset)
Load a model.

Parameters:
offset - the index offset of the model to load. (1 for next, -1 for previous)
Since:
12.08.2012

setFurniture

public void setFurniture(Furniture furn)
Description copied from interface: IModelViewer
Method to set a furniture to view.

Specified by:
setFurniture in interface IModelViewer
Parameters:
furn - The furniture to view.

isShowScaleGrid

public boolean isShowScaleGrid()
Description copied from interface: IModelViewer
Checks if is showing scale grid.

Specified by:
isShowScaleGrid in interface IModelViewer
Returns:
true, if is showing scale grid

setShowScaleGrid

public void setShowScaleGrid(boolean showScaleGrid)
Description copied from interface: IModelViewer
Sets the show scale grid flag.

Specified by:
setShowScaleGrid in interface IModelViewer
Parameters:
showScaleGrid - the new show scale grid flag.

isShowUserScaleGrid

public boolean isShowUserScaleGrid()
Description copied from interface: IModelViewer
Checks if is showing user scale grid.

Specified by:
isShowUserScaleGrid in interface IModelViewer
Returns:
true, if is showing user scale grid

setShowUserScaleGrid

public void setShowUserScaleGrid(boolean showUserScaleGrid)
Description copied from interface: IModelViewer
Sets the show user scale grid flag.

Specified by:
setShowUserScaleGrid in interface IModelViewer
Parameters:
showUserScaleGrid - the new show user scale grid flag.

simpleUpdate

public void simpleUpdate(float tpf)
Description copied from class: SimpleAppState
Simple update method. Place update code here.

Overrides:
simpleUpdate in class SimpleAppState
Parameters:
tpf - Time per frame.

centerFurniture

public void centerFurniture(boolean save)
Description copied from interface: IModelViewer
Centers the furniture.

Specified by:
centerFurniture in interface IModelViewer
Parameters:
save - Save the change if true.

rotateFurniture

public void rotateFurniture(float rotation,
                            boolean save)
Description copied from interface: IModelViewer
Rotate furniture.

Specified by:
rotateFurniture in interface IModelViewer
Parameters:
rotation - the amount of rotation.
save - Save the change if true.

arrangeText

public void arrangeText(int width,
                        int height)
Description copied from interface: IModelViewer
Arrange the text.

Specified by:
arrangeText in interface IModelViewer
Parameters:
width - the width of the viewer.
height - the height of the viewer.

main

public static void main(java.lang.String[] args)
Main method to test the class.

Parameters:
args - No arguments required.
Since:
12.08.2012